package server.analytics;

/**
 * This is an RMI-interface.
 * Methods defined in this interface may be invoked 
 * from different processes or hosts.
 * These methods are: subscribe, unsubscribe, processEvent.
 *
 * @version 1.0 vom 12.11.2012
 * @author Distributed Group 111 1026312, 1026309
 */

import java.rmi.Remote;
import java.rmi.RemoteException;

import client.management.ManagementClientNotifier;

import model.event.Event;

public interface AnalyticsServer extends Remote {

	/**
	 * This method is beeing invoked by the auction server if an event (for
	 * example: user login, auction started, ...) occurs.
	 * 
	 * @param event
	 *            the event that occurred.
	 * @throws RemoteException
	 *             thrown if any remote-exception occurs.
	 */
	void processEvent(Event event) throws RemoteException;

	/**
	 * This method is beeing invoked by a management client if a user wants to
	 * subscribe for some events (i.e. user-events, auction-events,
	 * statistics-events or bid-events). Futhermore is there a
	 * ManagementClientNotification-callback-object that is beeing used to send
	 * notifications to a ManagementClient.
	 * 
	 * @param regex
	 *            the regular expression that defines a filter, which events the
	 *            user wants to receive.
	 * @return a reference to a remoteobject of type subscription
	 * @throws RemoteException
	 *             thrown if any remote-exception occurs.
	 */
	Subscription subscribe(String regex, ManagementClientNotifier clientNotifier)
			throws RemoteException;

	/**
	 * This method is beeing invoked by a management client if a user wants to
	 * unsubscribe his/her subscription.
	 * 
	 * @param subscription
	 *            the remote-subscription object.
	 * @return message, if the the management client successfully unsubscribed
	 *         or not.
	 * @throws RemoteException
	 *             thrown if any remote-exception occurs.
	 */
	// this method is never been called
	String unsubscribe(Subscription subscription) throws RemoteException;
}